package com.duapk.index.work;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 清除调用shell脚本时的缓存数据
 * @Package: com.duapk.index.work
 * @ClassName: StreamWork
 * @author: jiangzheng
 * @date: Apr 5, 2011 4:51:03 PM
 *
 */
public class StreamWork extends Thread {
	private static Logger logger = LoggerFactory.getLogger(StreamWork.class);

	private InputStream ins;

	public StreamWork(InputStream ins) {
		this.ins = ins;
	}

	public void run() {
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new InputStreamReader(ins));
			while (reader.readLine() != null) {
			}
		} catch (Exception e) {
			logger.error("StreamWork error.", e);
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
					logger.error("close BufferedReader error.", e);
				}
			}
		}
	}

}
